-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
3884022
commit 2f6d170
Showing
15 changed files
with
178 additions
and
131 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
name: CI | ||
|
||
on: | ||
push: | ||
pull_request: | ||
branches: | ||
- master | ||
schedule: | ||
- cron: '0 0 * * *' | ||
|
||
jobs: | ||
node18: | ||
name: Node 18 | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: checkout node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '18' | ||
- run: npm install | ||
node20: | ||
name: Node 20 | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: checkout node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- run: npm install | ||
node22: | ||
name: Node 22 | ||
runs-on: ubuntu-24.04 | ||
steps: | ||
- name: checkout | ||
uses: actions/checkout@v4 | ||
- name: checkout node | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: '22' | ||
- run: npm install | ||
- run: npm run lint | ||
- run: npm run cs | ||
- name: sonarcloud.io | ||
uses: sonarsource/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
dist | ||
node_modules | ||
package-lock.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
src/build.ts |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
export { default } from '@chubbyts/chubbyts-eslint/eslint.config'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
sonar.organization=chubbyts | ||
sonar.projectKey=chubbyts_chubbyts-packaging | ||
sonar.projectName=chubbyts-packaging | ||
|
||
sonar.sources=src | ||
sonar.language=typescript | ||
sonar.sourceEncoding=UTF-8 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
import { execSync } from 'child_process'; | ||
import { existsSync, mkdirSync, readdirSync, readFileSync, rmSync, statSync, writeFileSync } from 'fs'; | ||
import { dirname, basename } from 'path'; | ||
|
||
const getAllFiles = (path: string): Array<string> => { | ||
return readdirSync(path) | ||
.map((file) => { | ||
const filePath = path + '/' + file; | ||
if (statSync(filePath).isDirectory()) { | ||
return getAllFiles(filePath); | ||
} | ||
|
||
return [filePath]; | ||
}) | ||
.flat(); | ||
}; | ||
|
||
const distDir = './dist'; | ||
const commonJsDistDir = distDir + '/cjs'; | ||
const moduleDistDir = distDir + '/esm'; | ||
|
||
rmSync(distDir, { recursive: true, force: true }); | ||
|
||
try { | ||
execSync(`./node_modules/.bin/tsc --module commonjs --outDir ${commonJsDistDir}`); | ||
execSync(`./node_modules/.bin/tsc --module esnext --outDir ${moduleDistDir}`); | ||
execSync(`./node_modules/.bin/tsc --declaration --emitDeclarationOnly --outDir ${distDir}`); | ||
} catch (e) { | ||
console.log(e?.toString()); | ||
|
||
process.exit(1); | ||
} | ||
|
||
getAllFiles(commonJsDistDir).map((file) => { | ||
const name = basename(file); | ||
const fromFolder = dirname(file); | ||
const toFolder = distDir + fromFolder.substring(commonJsDistDir.length); | ||
|
||
if (!name.match(/\.js$/)) { | ||
return; | ||
} | ||
|
||
if (!existsSync(toFolder)) { | ||
mkdirSync(toFolder, { recursive: true }); | ||
} | ||
|
||
const fromPath = fromFolder + '/' + name; | ||
const toPath = toFolder + '/' + name.replace(/\.js$/, '.cjs'); | ||
|
||
writeFileSync( | ||
toPath, | ||
readFileSync(fromPath, { encoding: 'utf8', flag: 'r' }).replace(/require\("\.([^"]+)"\)/g, 'require(".$1.cjs")'), | ||
); | ||
}); | ||
|
||
rmSync(commonJsDistDir, { recursive: true, force: true }); | ||
|
||
getAllFiles(moduleDistDir).map((file) => { | ||
const name = basename(file); | ||
const fromFolder = dirname(file); | ||
const toFolder = distDir + fromFolder.substring(moduleDistDir.length); | ||
|
||
if (!name.match(/\.js$/)) { | ||
return; | ||
} | ||
|
||
if (!existsSync(toFolder)) { | ||
mkdirSync(toFolder, { recursive: true }); | ||
} | ||
|
||
const fromPath = fromFolder + '/' + name; | ||
const toPath = toFolder + '/' + name.replace(/\.js$/, '.mjs'); | ||
|
||
writeFileSync( | ||
toPath, | ||
readFileSync(fromPath, { encoding: 'utf8', flag: 'r' }).replace(/from '\.([^']+)'/g, "from '.$1.mjs'"), | ||
); | ||
}); | ||
|
||
rmSync(moduleDistDir, { recursive: true, force: true }); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
{ | ||
"extends": "./tsconfig.json", | ||
"include": [ | ||
"eslint.config.mjs", | ||
"src" | ||
], | ||
} |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.