-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from smorimoto/native-esm
Native ESM
- Loading branch information
Showing
31 changed files
with
2,272 additions
and
6,544 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 |
---|---|---|
@@ -1,6 +1,6 @@ | ||
name: Example Dependency Submission | ||
on: | ||
push | ||
|
||
on: push | ||
|
||
permissions: | ||
contents: write | ||
|
@@ -9,21 +9,15 @@ jobs: | |
example-submission: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: 'Checkout Repository' | ||
uses: actions/checkout@v4 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-node@v4 | ||
# As of 2023-02-22, the ubuntu-latest image uses npm v8.3.1. This version | ||
# has a bug that prevents loading dependency-submission-toolkit in the | ||
# 'example/' project. npm v8.4.1 (same version in Codespace created on | ||
# same date) is known to work. Not pinned to latest to avoid | ||
# reproducibility issues. | ||
- run: npm install [email protected] -g | ||
with: | ||
node-version: 16 | ||
- name: Install NPM dependencies | ||
run: npm ci | ||
- name: Run all NPM build/test actions | ||
run: npm -w:example rebuild && npm run all -w:example | ||
run: npm run --workspace example all | ||
- name: Run dependency submission | ||
uses: ./ | ||
id: example | ||
with: | ||
npm-package-directory: ./ |
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 |
---|---|---|
@@ -1,7 +1,8 @@ | ||
name: 'build-test' | ||
|
||
on: # rebuild any PRs and main branch changes | ||
pull_request: | ||
branches: | ||
branches: | ||
- main | ||
- 'releases/*' | ||
push: | ||
|
@@ -14,14 +15,10 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
# As of 2023-02-22, the ubuntu-latest image uses npm v8.3.1. This version | ||
# has a bug that prevents loading dependency-submission-toolkit in the | ||
# 'example/' project. npm v8.4.1 (same version in Codespace created on | ||
# same date) is known to work. Not pinned to latest to avoid | ||
# reproducibility issues. | ||
- run: npm install [email protected] -g | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: 16 | ||
- name: Install NPM dependencies | ||
run: npm ci | ||
- run: npm install | ||
- name: Run all NPM build/test actions | ||
run: npm rebuild && npm run all | ||
run: npm run all |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
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 |
---|---|---|
|
@@ -11,4 +11,4 @@ inputs: | |
default: './' | ||
runs: | ||
using: 'node16' | ||
main: 'example/action-dist/index.js' | ||
main: 'example/dist/index.js' |
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,31 @@ | ||
{ | ||
"$schema": "node_modules/@biomejs/biome/configuration_schema.json", | ||
"files": { | ||
"ignoreUnknown": true | ||
}, | ||
"formatter": { | ||
"enabled": true, | ||
"indentStyle": "space" | ||
}, | ||
"javascript": { | ||
"formatter": { | ||
"quoteStyle": "single", | ||
"semicolons": "asNeeded", | ||
"trailingComma": "none" | ||
} | ||
}, | ||
"linter": { | ||
"enabled": true, | ||
"rules": { | ||
"recommended": true | ||
} | ||
}, | ||
"organizeImports": { | ||
"enabled": true | ||
}, | ||
"vcs": { | ||
"clientKind": "git", | ||
"enabled": true, | ||
"useIgnoreFile": true | ||
} | ||
} |
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,3 +1,3 @@ | ||
import { main } from './npm-detector' | ||
import { main } from './npm-detector.js' | ||
|
||
main() |
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 |
---|---|---|
@@ -1,10 +1,11 @@ | ||
import { PackageCache } from '@github/dependency-submission-toolkit' | ||
import { describe, expect, test } from 'vitest' | ||
|
||
import { | ||
parseNameAndNamespace, | ||
createBuildTarget, | ||
parseDependencies, | ||
createBuildTarget | ||
} from './npm-detector' | ||
|
||
import { PackageCache } from '@github/dependency-submission-toolkit' | ||
parseNameAndNamespace | ||
} from './npm-detector.js' | ||
|
||
describe('parseNameAndNamespace', () => { | ||
test('parses single name, no namespace', () => { | ||
|
@@ -39,7 +40,7 @@ describe('parseDependencies', () => { | |
const pkgs = parseDependencies(cache, dependencies) | ||
|
||
expect(pkgs).toHaveLength(1) | ||
expect(pkgs[0].packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[0]?.packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(cache.countPackages()).toEqual(1) | ||
}) | ||
|
||
|
@@ -49,8 +50,8 @@ describe('parseDependencies', () => { | |
const pkgs = parseDependencies(cache, dependencies) | ||
|
||
expect(pkgs).toHaveLength(2) | ||
expect(pkgs[0].packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[1].packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[0]?.packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[1]?.packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(cache.countPackages()).toEqual(2) | ||
}) | ||
|
||
|
@@ -62,9 +63,9 @@ describe('parseDependencies', () => { | |
const pkgs = parseDependencies(cache, dependencies) | ||
|
||
expect(pkgs).toHaveLength(1) | ||
expect(pkgs[0].packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[0].packageDependencyIDs).toHaveLength(1) | ||
expect(pkgs[0].packageDependencyIDs[0]).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[0]?.packageID()).toEqual('pkg:npm/[email protected]') | ||
expect(pkgs[0]?.packageDependencyIDs).toHaveLength(1) | ||
expect(pkgs[0]?.packageDependencyIDs[0]).toEqual('pkg:npm/[email protected]') | ||
expect(cache.countPackages()).toEqual(2) | ||
}) | ||
}) | ||
|
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 |
---|---|---|
@@ -1,27 +1,23 @@ | ||
{ | ||
"name": "@github/npm-dependency-submission-example", | ||
"version": "1.0.0", | ||
"private": true, | ||
"description": "[UNPUBLISHED PACKAGE!] Example using the Dependency Submission Toolkit and npm list", | ||
"main": "index.ts", | ||
"dependencies": { | ||
"@github/dependency-submission-toolkit": "file:../", | ||
"packageurl-js": "^0.0.6" | ||
}, | ||
"type": "module", | ||
"scripts": { | ||
"build": "tsc", | ||
"test": "jest", | ||
"test:watch": "jest --watch", | ||
"package": "ncc build --source-map --license licenses.txt --out action-dist", | ||
"all": "npm run test && npm run build && npm run package" | ||
"all": "npm run type-check && npm run build && npm run test", | ||
"build": "ncc build index.ts --source-map --license=LICENSE.txt --out dist", | ||
"test": "vitest run", | ||
"test:watch": "vitest watch", | ||
"type-check": "tsc" | ||
}, | ||
"repository": { | ||
"type": "git", | ||
"url": "git+https://github.com/github/dependency-submission-toolkit.git" | ||
}, | ||
"author": "", | ||
"license": "MIT", | ||
"bugs": { | ||
"url": "https://github.com/github/dependency-submission-toolkit/issues" | ||
"dependencies": { | ||
"@github/dependency-submission-toolkit": "file:../", | ||
"packageurl-js": "^1.2.1" | ||
}, | ||
"homepage": "https://github.com/github/dependency-submission-toolkit#readme" | ||
"devDependencies": { | ||
"@tsconfig/strictest": "^2.0.2", | ||
"@vercel/ncc": "^0.38.1", | ||
"typescript": "^5.3.3", | ||
"vitest": "^1.1.3" | ||
} | ||
} |
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,19 +1,11 @@ | ||
{ | ||
"compilerOptions": { | ||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */ | ||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */ | ||
"outDir": "./dist", /* Redirect output structure to the directory. */ | ||
"strict": true, /* Enable all strict type-checking options. */ | ||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */ | ||
"esModuleInterop": true, /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */ | ||
"skipLibCheck": true, | ||
"sourceMap": true, | ||
"paths": { | ||
"@github/dependency-submission-toolkit": ["../src"] | ||
} | ||
"isolatedModules": true, | ||
"module": "ESNext", | ||
"moduleDetection": "force", | ||
"moduleResolution": "Bundler", | ||
"noEmit": true | ||
}, | ||
"exclude": [ | ||
"dist", | ||
"*.test.ts" | ||
] | ||
"exclude": ["dist", "node_modules"], | ||
"extends": "@tsconfig/strictest/tsconfig.json" | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.