Skip to content

Commit

Permalink
chore: ci debug
Browse files Browse the repository at this point in the history
  • Loading branch information
narol1024 committed Jun 1, 2024
1 parent 783257b commit eca9420
Show file tree
Hide file tree
Showing 8 changed files with 41 additions and 22 deletions.
1 change: 1 addition & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ jobs:
- uses: actions/setup-node@v3
with:
node-version: 16
- run: npm install
- run: npm run test:coverage
- run: npm run test:ci

18 changes: 14 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 4 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
{
"name": "sdp-analyzer",
"type": "module",
"main": "dist/index.js",
"bin": "dist/cli/index.js",
"types": "dist/main.d.ts",
Expand All @@ -16,14 +17,15 @@
"format:check": "prettier \"./**\" --ignore-unknown --check"
},
"dependencies": {
"@types/node-fetch": "^2.6.11",
"cheerio": "^1.0.0-rc.12",
"commander": "^12.1.0",
"fast-glob": "^3.3.2",
"jsonfile": "^6.1.0",
"node-fetch": "^2.x"
"node-fetch": "^2.x",
"tslib": "^2.3.1"
},
"devDependencies": {
"@types/node-fetch": "^2.6.11",
"@commitlint/cli": "^17.0.0",
"@commitlint/config-conventional": "^17.0.0",
"@jest/globals": "^28.0.0",
Expand Down
2 changes: 1 addition & 1 deletion src/platforms/npm-package/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
*/
import { readNpmPackageDependencies, analyze } from './index';

describe('Workspaces Test', () => {
describe('Npm pacakge Test', () => {
it('should not read a non-existent package', async () => {
await expect(readNpmPackageDependencies('is-a-non-existent-package')).rejects.toEqual(
new Error('Cannot read is-a-non-existent-package.'),
Expand Down
8 changes: 4 additions & 4 deletions src/platforms/workspaces/yarn/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
* This is a sample test suite.
* Replace this with your implementation.
*/
import { readWorkspacesDependencies, analyzeYarnWorkspaces } from './index';
import { readWorkspacesDependencies, analyze } from './index';

describe('Workspaces Test', () => {
it('should be that the package.json cannot be found', () => {
Expand All @@ -11,9 +11,9 @@ describe('Workspaces Test', () => {
}).toThrow(new Error(`Cannot find package.json on ./error-path.`));
});
it('should be that the package.json can be found', () => {
expect(readWorkspacesDependencies('./src/platforms/yarn/fixture')).toMatchSnapshot();
expect(readWorkspacesDependencies('./src/platforms/workspaces/yarn/fixture')).toMatchSnapshot();
});
it('should return a dep tree', () => {
expect(analyzeYarnWorkspaces('./src/platforms/yarn/fixture')).toMatchSnapshot();
it('should return a dep tree', async () => {
await expect(analyze('./src/platforms/workspaces/yarn/fixture')).resolves.toMatchSnapshot();
});
});
20 changes: 11 additions & 9 deletions src/platforms/workspaces/yarn/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ export async function analyze(packagePath: string) {
fanOut: v.dependencies ? Object.keys(v.dependencies).length : 0,
};
});
return deps.map(dep => {
const stablility = evaluate(dep.fanOut, dep.fanIn);
return {
...dep,
instable: stablility,
label: getStablityLabel(stablility),
};
});
return Promise.resolve(
deps.map(dep => {
const stablility = evaluate(dep.fanOut, dep.fanIn);
return {
...dep,
instable: stablility,
label: getStablityLabel(stablility),
};
}),
);
} catch (error) {
throw error;
return Promise.reject(new Error(`Cannot analyze ${packagePath}`));
}
}
4 changes: 4 additions & 0 deletions tsconfig.build.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
},
"extends": "./tsconfig.json",
"exclude": [
"dist",
Expand Down
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "Node",
"allowSyntheticDefaultImports": true,
"esModuleInterop": true,
Expand Down

0 comments on commit eca9420

Please sign in to comment.