-
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.
* Add update script * Add tests * Fix syntax error * Fix syntax error * Upload all tests * Add trigger * Update name * Update build script * Update artifact name * Update folder * Update tarball filename * Merge Dockerfile * Add LTS/latest and debug * Reduce versions * Separate tests * Fix build script * Fix syntax error * Fix build script * Separate RUN commands * Remove unneeded files * Update deps * Update read-pkg-up * Fix test * Fix expected.txt * Change directory before test * Add more tests * Add esbuild * Update expected * Add npm-version * Fix build-arg * Rename matrix * Add webpack-esm * Add rollup * Add 12.x * Reduce test files * Clean up * Move terser to devDependencies * Better task names * Update version of @babel/runtime * Add global test * Only upload once * Add PR template * Add entry * Add summary section
- Loading branch information
Showing
42 changed files
with
1,395 additions
and
1,999 deletions.
There are no files selected for viewing
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,27 @@ | ||
## Summary | ||
|
||
<!-- Explain the purpose of this pull request in one line. --> | ||
|
||
## Changelog | ||
|
||
### Fixed/Added/Changed | ||
|
||
<!-- Copy and paste the entry from CHANGELOG.md. --> | ||
|
||
## Design considerations | ||
|
||
<!-- Explains how we come up with the final design and design candidates (if any). --> | ||
|
||
## Specific changes | ||
|
||
<!-- Explains what changed in details. --> | ||
|
||
- | ||
|
||
## Reminders | ||
|
||
<!-- Checks all boxes even if it is irrelevant to this pull request. --> | ||
|
||
- [ ] I have updated `CHANGELOG.md` | ||
- [ ] I have added tests for new code | ||
- [ ] I have updated documentations |
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,96 @@ | ||
name: Pull request validation | ||
|
||
on: | ||
pull_request: | ||
|
||
workflow_dispatch: | ||
inputs: | ||
version: | ||
description: 'Version' | ||
required: true | ||
default: 'master' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
matrix: | ||
node-version: ['12', '14', '16'] | ||
npm-version: [default, latest] | ||
|
||
steps: | ||
- name: Checking out for ${{ github.ref }} | ||
uses: actions/checkout@v2 | ||
|
||
- name: Use Node.js ${{ matrix.node-version }} | ||
uses: actions/setup-node@v2 | ||
with: | ||
node-version: ${{ matrix.node-version }} | ||
|
||
- name: Install latest NPM | ||
if: ${{ matrix.npm-version == 'latest' }} | ||
run: npm install -g npm | ||
|
||
- run: | | ||
npm install | ||
npm run prepublishOnly | ||
npm pack | ||
- name: Upload end-to-end tests | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ matrix.node-version == '16' && matrix.npm-version == 'default' }} | ||
with: | ||
name: e2e-tests | ||
path: '__e2e__/**/*' | ||
|
||
- name: Upload package tarball | ||
uses: actions/upload-artifact@v2 | ||
if: ${{ matrix.node-version == '16' && matrix.npm-version == 'default' }} | ||
with: | ||
name: package | ||
path: '*.tgz' | ||
|
||
test: | ||
needs: build | ||
runs-on: ubuntu-latest | ||
|
||
strategy: | ||
fail-fast: false | ||
matrix: | ||
resolver: | ||
- esbuild | ||
- node-commonjs | ||
- node-esm | ||
- node-global | ||
- rollup | ||
- webpack4-commonjs | ||
- webpack4-esm | ||
- webpack5-commonjs | ||
- webpack5-esm | ||
node-version: ['12', '14', '16'] | ||
npm-version: [default, latest] | ||
|
||
steps: | ||
- name: Download end-to-end tests | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: e2e-tests | ||
|
||
- name: Download package tarball | ||
uses: actions/download-artifact@v2 | ||
with: | ||
name: package | ||
|
||
- name: Build test image | ||
run: | | ||
cd ${{ matrix.resolver }} | ||
cp ../*.tgz . | ||
ls -la | ||
docker build --build-arg NODE_VERSION=${{ matrix.node-version }} --build-arg NPM_VERSION=${{ matrix.npm-version }} --file Dockerfile --tag test-image . | ||
- name: Run test | ||
run: | | ||
cd ${{ matrix.resolver }} | ||
docker run --name test-container test-image > actual.txt | ||
diff expected.txt actual.txt |
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 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 @@ | ||
/**/p-defer-es5-*.tgz |
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,21 @@ | ||
ARG NODE_VERSION=16 | ||
|
||
FROM node:$NODE_VERSION-alpine | ||
ARG NPM_VERSION | ||
|
||
WORKDIR /var/test/ | ||
COPY * /var/test/ | ||
|
||
RUN if [[ "$NPM_VERSION" == "latest" ]] ; then npm install -g npm ; fi | ||
|
||
RUN node --version | ||
RUN npm --version | ||
|
||
RUN npm init --yes | ||
RUN npm install p-defer | ||
RUN npm install ./`ls *.tgz` | ||
|
||
# The lowest version supported by ESBuild is "es2016". | ||
RUN npx esbuild ./index.js --bundle --minify --outfile=./dist/main.js --target=es2016 | ||
|
||
ENTRYPOINT node ./dist/main.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 @@ | ||
Hello, World! |
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,17 @@ | ||
// When bundling with esbuild: | ||
// - If we "import", it load ESM from "p-defer-es5/module". The default imported object is () => any. | ||
// - If we "require", it load CJS from "p-defer-es5/main". The default imported object is () => any. | ||
|
||
// When bundling with Webpack: | ||
// - Nomatter we "import" or "require", it always load ESM from "p-defer-es5/module", based on the "webpack.config.json/mainFields". | ||
// - If we "import", the default imported object is () => any. | ||
// - If we "require", the default imported object is { default: () => any }. | ||
// - If we "require" and "mainFields" is "main", the default imported object is () => any. | ||
|
||
const createDeferred = require('p-defer-es5'); | ||
|
||
const { promise, resolve } = createDeferred(); | ||
|
||
setTimeout(() => resolve('Hello, World!'), 0); | ||
|
||
promise.then(result => console.log(result)); |
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,18 @@ | ||
ARG NODE_VERSION=16 | ||
|
||
FROM node:$NODE_VERSION-alpine | ||
ARG NPM_VERSION | ||
|
||
WORKDIR /var/test/ | ||
COPY * /var/test/ | ||
|
||
RUN if [[ "$NPM_VERSION" == "latest" ]] ; then npm install -g npm ; fi | ||
|
||
RUN node --version | ||
RUN npm --version | ||
|
||
RUN npm init --yes | ||
RUN npm install p-defer | ||
RUN npm install ./`ls *.tgz` | ||
|
||
ENTRYPOINT node ./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 @@ | ||
Hello, World! |
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 @@ | ||
const createDeferred = require('p-defer-es5'); | ||
|
||
const { promise, resolve } = createDeferred(); | ||
|
||
setTimeout(() => resolve('Hello, World!'), 0); | ||
|
||
promise.then(console.log.bind(console)); |
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,18 @@ | ||
ARG NODE_VERSION=16 | ||
|
||
FROM node:$NODE_VERSION-alpine | ||
ARG NPM_VERSION | ||
|
||
WORKDIR /var/test/ | ||
COPY * /var/test/ | ||
|
||
RUN if [[ "$NPM_VERSION" == "latest" ]] ; then npm install -g npm ; fi | ||
|
||
RUN node --version | ||
RUN npm --version | ||
|
||
RUN npm init --yes | ||
RUN npm install p-defer | ||
RUN npm install ./`ls *.tgz` | ||
|
||
ENTRYPOINT node ./index.mjs |
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 @@ | ||
Hello, World! |
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 @@ | ||
import createDeferred from 'p-defer-es5'; | ||
|
||
const { promise, resolve } = createDeferred(); | ||
|
||
setTimeout(() => resolve('Hello, World!'), 0); | ||
|
||
promise.then(console.log.bind(console)); |
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,18 @@ | ||
ARG NODE_VERSION=16 | ||
|
||
FROM node:$NODE_VERSION-alpine | ||
ARG NPM_VERSION | ||
|
||
WORKDIR /var/test/ | ||
COPY * /var/test/ | ||
|
||
RUN if [[ "$NPM_VERSION" == "latest" ]] ; then npm install -g npm ; fi | ||
|
||
RUN node --version | ||
RUN npm --version | ||
|
||
RUN npm init --yes | ||
RUN npm install p-defer | ||
RUN npm install ./`ls *.tgz` | ||
|
||
ENTRYPOINT node ./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 @@ | ||
Hello, World! |
Oops, something went wrong.