ppackage 2.4.3 → 2.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/index.js CHANGED
@@ -1,3 +1,4 @@
1
+ #!/usr/bin/env node
1
2
  "use strict";
2
3
 
3
4
  const fs = require('fs');
@@ -5,7 +6,8 @@ const path = require('path');
5
6
  const semver = require('semver');
6
7
  const {spawn} = require('child_process');
7
8
 
8
- const args = require('nyks/process/parseArgs')();
9
+
10
+ const {args} = require('nyks/process/parseArgs')();
9
11
  const passthru = require('nyks/child_process/passthru');
10
12
  const wait = require('nyks/child_process/wait');
11
13
  const trim = require('mout/string/trim');
@@ -149,7 +151,7 @@ class ppackage {
149
151
  if(line.repository) current_repository = line.repository;
150
152
  }
151
153
 
152
- let target_repository = repository || args.args.shift() || current_repository;
154
+ let target_repository = repository || args.shift() || current_repository;
153
155
 
154
156
  if(!target_repository)
155
157
  throw `Invalid repository url`;
@@ -166,7 +168,6 @@ class ppackage {
166
168
  }
167
169
 
168
170
  async version(version = false, notag = false) {
169
-
170
171
  let repositories = [];
171
172
 
172
173
  let current_version;
@@ -180,7 +181,7 @@ class ppackage {
180
181
  throw `Inconsitant repository ${unique(repositories).join(',')} detected, use ppackage repository first`;
181
182
 
182
183
 
183
- let target_version = version || args.args.shift();
184
+ let target_version = version || args.shift();
184
185
 
185
186
  let dirty = await wait(spawn('git', ["diff-index", "--quiet", "HEAD"])).catch(() => true);
186
187
  if(dirty && !notag)
@@ -218,7 +219,10 @@ class ppackage {
218
219
  }
219
220
 
220
221
 
221
- async gitify() {
222
+ async gitify(branch = null) {
223
+
224
+ if(!branch)
225
+ branch = args.shift() || "master";
222
226
 
223
227
  if(fs.existsSync(GIT_FOLDER))
224
228
  throw `Cowardly aborting working with existing git project`;
@@ -230,12 +234,14 @@ class ppackage {
230
234
  await passthru("git", ["clone", ...cloneopts, repository_url, GIT_FOLDER]);
231
235
 
232
236
  await passthru("git", ["config", "--unset", "core.bare"]);
233
- await passthru("git", ["reset", "HEAD", "--", "."]);
237
+ await passthru("git", ["reset", branch]);
238
+ await passthru("git", ["checkout", branch]);
234
239
 
235
- for(let line of [GITIGNORE_PATH, DOCKERIGNORE_PATH, NPMIGNORE_PATH, NPMRC_PATH])
240
+ for(let line of [GITIGNORE_PATH, DOCKERIGNORE_PATH, NPMIGNORE_PATH])
236
241
  await passthru("git", ["checkout", "--", line]).catch(()=>{});
237
242
 
238
- let restore = [];
243
+
244
+ let restore = [".git*", NPMRC_PATH];
239
245
  if(fs.existsSync(DOCKERIGNORE_PATH)) {
240
246
  let ignore = fs.readFileSync(DOCKERIGNORE_PATH, 'utf8');
241
247
  restore.push(...ignore.split("\n"));
@@ -275,9 +281,14 @@ class ppackage {
275
281
  return {repository_url};
276
282
  }
277
283
 
278
-
279
284
  }
280
285
 
281
286
 
287
+ //ensure module is called directly, i.e. not required
288
+ if(module.parent === null) {
289
+ let cmd = args.shift();
290
+ require('cnyks/lib/bundle')(ppackage, null, [`--ir://run=${cmd}`]); //start runner
291
+ }
292
+
282
293
  module.exports = ppackage;
283
294
 
package/package.json CHANGED
@@ -1,15 +1,14 @@
1
1
  {
2
2
  "name": "ppackage",
3
- "version": "2.4.3",
3
+ "version": "2.6.0",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "bin": {
7
- "ppackage": "./bin/ppackage",
8
- "ddev": "./bin/ddev",
7
+ "ppackage": "index.js",
9
8
  "askpass": "./bin/askpass"
10
9
  },
11
10
  "dependencies": {
12
- "cnyks": "^3.1.3",
11
+ "cnyks": "^3.2.1",
13
12
  "mout": "^1.0.0",
14
13
  "nyks": "^6.1.8",
15
14
  "semver": "^5.3.0",
package/bin/ddev DELETED
@@ -1 +0,0 @@
1
- cnyks ddev --ir://run=$*
package/bin/ppackage DELETED
@@ -1 +0,0 @@
1
- cnyks ppackage --ir://run=$*