Skip to content

Commit

Permalink
Shell build directive (#57)
Browse files Browse the repository at this point in the history
* Base work

* Launch shell code

* Add node-gyp in NpmSemverResolver

* Add node-addon-api as unplugged

* Indent imports

* Update snapshots (manually)

* Add tests

* Update builds

* Fix spaces in braces

* Fix lint and test on windows

* Implement review comments

* Use parseSyml instead of checking content

* Fix condition and add warning if node-gyp is injected

* Update NpmSemverResolver.ts
  • Loading branch information
Embraser01 authored and arcanis committed Apr 23, 2019
1 parent 812648d commit 7be17b4
Show file tree
Hide file tree
Showing 30 changed files with 3,725 additions and 5,493 deletions.
30 changes: 4 additions & 26 deletions .pnp.js

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

3 changes: 2 additions & 1 deletion packages/acceptance-tests/berry.setup.js
@@ -1,6 +1,7 @@
/* @flow */

const {delimiter} = require(`path`);
const isWsl = require(`is-wsl`);

const {
tests: {generatePkgDriver, startPackageServer, getPackageRegistry},
Expand Down Expand Up @@ -50,7 +51,7 @@ global.makeTemporaryEnv = generatePkgDriver({
},
});

if (process.platform === `win32`) {
if (process.platform === `win32` || isWsl) {
jest.setTimeout(10000);
}

Expand Down
3 changes: 2 additions & 1 deletion packages/acceptance-tests/package.json
Expand Up @@ -8,7 +8,8 @@
],
"dependencies": {
"@berry/fslib": "workspace:*",
"@berry/monorepo": "workspace:*"
"@berry/monorepo": "workspace:*",
"is-wsl": "^1.1.0"
},
"scripts": {
"test:integration": "run test:unit --config \"$(pwd)/jest.config.js\""
Expand Down
Expand Up @@ -137,7 +137,7 @@ exports.createTemporaryFolder = function createTemporaryFolder(name?: string): P
dirPath = posix.join(dirPath, name);
await exports.mkdirp(dirPath);
}

return dirPath;
});
};
Expand Down
@@ -1,5 +1,5 @@
const {Minimatch} = require('minimatch');
const path = require('path');
const {posix} = require('path');

exports.stringPatternMatch = function stringPatternMatch(
string: string,
Expand Down Expand Up @@ -37,7 +37,7 @@ exports.filePatternMatch = function filePatternMatch(
patterns: Array<string>,
{matchBase = true, dot = true}: {matchBase?: boolean, dot?: boolean} = {},
): boolean {
return exports.stringPatternMatch(path.resolve('/', filePath), patterns, {matchBase, dot});
return exports.stringPatternMatch(posix.resolve('/', filePath), patterns, {matchBase, dot});
};

exports.parseJsonStream = function parseJsonStream(
Expand Down
Empty file.
@@ -0,0 +1,10 @@
/* @flow */

module.exports = require(`./package.json`);

for (const key of [`dependencies`, `devDependencies`, `peerDependencies`]) {
for (const dep of Object.keys(module.exports[key] || {})) {
// $FlowFixMe The whole point of this file is to be dynamic
module.exports[key][dep] = require(dep);
}
}
@@ -0,0 +1,7 @@
{
"name": "binding-gyp-scripts",
"version": "1.0.0",
"dependencies": {
"node-gyp": "^1.0.0"
}
}
@@ -0,0 +1,10 @@
/* @flow */

module.exports = require(`./package.json`);

for (const key of [`dependencies`, `devDependencies`, `peerDependencies`]) {
for (const dep of Object.keys(module.exports[key] || {})) {
// $FlowFixMe The whole point of this file is to be dynamic
module.exports[key][dep] = require(dep);
}
}
@@ -0,0 +1,7 @@
{
"name": "inject-node-gyp",
"version": "1.0.0",
"scripts": {
"install": "node-gyp help"
}
}
@@ -0,0 +1,10 @@
/* @flow */

module.exports = require(`./package.json`);

for (const key of [`dependencies`, `devDependencies`, `peerDependencies`]) {
for (const dep of Object.keys(module.exports[key] || {})) {
// $FlowFixMe The whole point of this file is to be dynamic
module.exports[key][dep] = require(dep);
}
}
@@ -0,0 +1,4 @@
const fs = require('fs');
const path = require('path');

fs.writeFileSync('build.node', `${process.cwd()}${path.sep}build.node`);
@@ -0,0 +1,7 @@
{
"name": "node-gyp",
"version": "1.0.0",
"bin": {
"node-gyp": "./node-gyp.js"
}
}

0 comments on commit 7be17b4

Please sign in to comment.