forked from microsoft/tslib
-
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
Showing
10 changed files
with
85 additions
and
36 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
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 |
---|---|---|
|
@@ -2,5 +2,8 @@ | |
"type": "module", | ||
"scripts": { | ||
"test": "node index.js" | ||
}, | ||
"engines": { | ||
"node": "14" | ||
} | ||
} |
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,54 @@ | ||
const { spawnSync } = require("child_process"); | ||
const fs = require("fs"); | ||
const path = require("path"); | ||
const mainVersion = Number(process.version.replace("v","").split(".")[0]) | ||
|
||
// Loop through all the folders and run `npm test` | ||
|
||
const blocklist = ["validateModuleExportsMatchCommonJS", "node_modules"]; | ||
const filesInTest = fs.readdirSync(__dirname); | ||
const tests = filesInTest | ||
.filter((f) => fs.statSync(path.join(__dirname, f)).isDirectory()) | ||
.filter((f) => !blocklist.includes(f)); | ||
|
||
// Support setting up the test node modules | ||
if (!filesInTest.includes("node_modules")) { | ||
console.log("Installing Deps..."); | ||
spawnSync("npm", ["install"], { cwd: __dirname }); | ||
console.log("Installed"); | ||
} | ||
|
||
const chalk = require("chalk").default; | ||
for (const test of tests) { | ||
console.log("---> " + chalk.bold(test)); | ||
|
||
const pgkJSON = require(path.join(__dirname, test, "package.json")); | ||
|
||
// Allow skipping things which need a minimum of node 14 (es modules) | ||
if (pgkJSON.engines && pgkJSON.engines.node) { | ||
const minVersion = Number(pgkJSON.engines.node) | ||
if (minVersion > mainVersion) { | ||
console.log("Skipping") | ||
continue | ||
} | ||
} | ||
|
||
// The webpack 5 tests have unique deps | ||
if (pgkJSON.dependencies || pgkJSON.devDependencies) { | ||
const nodeModsInstalled = fs.existsSync(path.join(__dirname, test, "node_modules")); | ||
if (!nodeModsInstalled) { | ||
spawnSync("npm", ["install"], { cwd: path.join(__dirname, test) }); | ||
} | ||
} | ||
|
||
// Run the test command | ||
const results = spawnSync("npm", ["test"], { cwd: path.join(__dirname, test) }); | ||
console.log(results.stdout.toString()) | ||
if (results.status) { | ||
console.log(chalk.bold.red("Error running test: ") + chalk.bold(test)) | ||
console.log(results.stderr.toString()) | ||
console.log(chalk.bold.red("^^^ Error running test: ") + chalk.bold(test)) | ||
process.exitCode = results.status | ||
} | ||
} | ||
|
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 |
---|---|---|
|
@@ -3,5 +3,8 @@ | |
|
||
"scripts": { | ||
"test": "../node_modules/.bin/snowpack build; node build/index.js" | ||
}, | ||
"engines": { | ||
"node": "14" | ||
} | ||
} |
File renamed without changes.
File renamed without changes.
File renamed without changes.
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,2 @@ | ||
import { __awaiter } from "tslib"; | ||
if (typeof __awaiter !== "function") throw new Error("Missing expected helper __awaiter"); |
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,9 @@ | ||
{ | ||
"scripts": { | ||
"test": "webpack && node build/main.js" | ||
}, | ||
"devDependencies": { | ||
"webpack": "5.0.0-rc.4", | ||
"webpack-cli": "3.3.12" | ||
} | ||
} |
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,12 @@ | ||
const path = require('path'); | ||
|
||
/** @type {import("webpack").Configuration} */ | ||
const config = { | ||
mode: "production", | ||
entry: "./index", | ||
output: { | ||
path: path.join(process.cwd(), 'build') | ||
} | ||
} | ||
|
||
module.exports = config |