simplified-shopify-cli 0.1.3 → 0.1.5

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/README.md CHANGED
@@ -19,7 +19,7 @@ or enable [short commands](#shell-setup).
19
19
 
20
20
  ## 2. Store Abreviations Mapping
21
21
 
22
- Personal config is created automatically on install at `~/.sshop.json`.
22
+ Personal config is created automatically on first use at `~/.sshop.json`.
23
23
 
24
24
 
25
25
  | Command | Description |
@@ -31,7 +31,7 @@ Personal config is created automatically on install at `~/.sshop.json`.
31
31
 
32
32
  Example `~/.sshop.json`:
33
33
 
34
- ```json
34
+ ```jsonc
35
35
  {
36
36
  "version": 1,
37
37
  "stores": {
package/docs/RELEASING.md CHANGED
@@ -1,3 +1,12 @@
1
+ # Release 0.1.5
2
+
3
+ Remove `postinstall` to avoid npm `allow-scripts` warnings on global install.
4
+ Personal config is now created on first command use instead.
5
+
6
+ # Release 0.1.4
7
+
8
+ README fix: use `jsonc` for the config example so inline default comments preview correctly.
9
+
1
10
  # Release 0.1.3
2
11
 
3
12
  Store setup improvements: `sstores` defaults to global config, `sstores .` opens the
@@ -38,6 +47,23 @@ Personal `.sshop.json` and legacy `base_custom_cli.sh` are ignored and excluded
38
47
  from npm. The LICENSE contains the owner's public copyright attribution.
39
48
  Pattern checks reduce leakage risk; they are not a complete security audit.
40
49
 
50
+ ## Publishing authentication
51
+
52
+ `npm login` session tokens still require a one-time password when 2FA is enabled
53
+ for publishing. For OTP-free publishes, create a token once and store it in your
54
+ user `~/.npmrc` (never commit it):
55
+
56
+ 1. Sign in at [npmjs.com](https://www.npmjs.com/) → **Access Tokens** → **Generate New Token**.
57
+ 2. Choose **Granular Access Token** (recommended) or **Classic Automation Token**.
58
+ 3. Grant **Read and write** access to the `simplified-shopify-cli` package.
59
+ 4. Save the token locally:
60
+
61
+ ```sh
62
+ npm config set //registry.npmjs.org/:_authToken=YOUR_TOKEN --location=user
63
+ ```
64
+
65
+ After that, `npm publish ARCHIVE --access public` works without `--otp`.
66
+
41
67
  ## Publishing procedure
42
68
 
43
69
  1. Update the version and documentation; run `npm run release:check`.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "simplified-shopify-cli",
3
- "version": "0.1.3",
3
+ "version": "0.1.5",
4
4
  "description": "Configurable store aliases and shortcuts for Shopify theme development",
5
5
  "type": "module",
6
6
  "license": "MIT",
@@ -27,7 +27,6 @@
27
27
  "files": [
28
28
  "bin/",
29
29
  "src/",
30
- "scripts/postinstall.js",
31
30
  "shell/",
32
31
  "examples/",
33
32
  "docs/",
@@ -36,8 +35,7 @@
36
35
  ],
37
36
  "scripts": {
38
37
  "test": "node --test",
39
- "check": "node --check bin/sshop.js && node --check src/cli.js && node --check src/config.js && node --check src/commands.js && node --check scripts/postinstall.js",
40
- "postinstall": "node scripts/postinstall.js",
38
+ "check": "node --check bin/sshop.js && node --check src/cli.js && node --check src/config.js && node --check src/commands.js",
41
39
  "generate:pdf": "python3 scripts/generate-cheat-sheet.py",
42
40
  "prepack": "npm run check && npm test",
43
41
  "release:check": "npm run check && npm test && node scripts/check-package.js"
package/src/config.js CHANGED
@@ -4,7 +4,14 @@ import path from 'node:path';
4
4
  import { randomUUID } from 'node:crypto';
5
5
 
6
6
  export const filename = '.sshop.json';
7
+ export const emptyConfig = { version: 1, stores: {}, defaults: { nodelete: true, themeEditorSync: true } };
7
8
  const own = (object, key) => Object.hasOwn(object, key);
9
+
10
+ export function ensureGlobalConfig({ home = os.homedir() } = {}) {
11
+ const file = path.join(home, filename);
12
+ if (!fs.existsSync(file)) writeConfig(file, emptyConfig, { create: true });
13
+ return file;
14
+ }
8
15
  export function normalizeStore(value) {
9
16
  if (typeof value !== 'string') throw new Error('Store must be a string.');
10
17
  const slug = value.trim().toLowerCase().replace(/^https?:\/\//, '').replace(/\/$/, '').replace(/\.myshopify\.com$/, '');
package/src/entry.js CHANGED
@@ -1,4 +1,5 @@
1
1
  import { main } from './cli.js';
2
+ import { ensureGlobalConfig } from './config.js';
2
3
 
3
4
  function usesGlobalStoresConfig(command, args) {
4
5
  return command === 'stores' && ['add', 'remove', '.'].includes(args[0]);
@@ -11,6 +12,9 @@ export async function runEntry(command, input = process.argv.slice(2)) {
11
12
  if (usesGlobalStoresConfig(command, args) && !global.length && !args.some(arg => arg === '-g' || arg === '--global')) {
12
13
  args.push('-g');
13
14
  }
15
+ if (command !== 'init' && !['--help', '-h', 'help', '--version'].includes(args[0])) {
16
+ ensureGlobalConfig();
17
+ }
14
18
  try {
15
19
  process.exitCode = await main([...global, ...(['--help', '-h', '--version'].includes(args[0]) ? args : [command, ...args])]);
16
20
  } catch (error) {
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import fs from 'node:fs';
3
- import os from 'node:os';
4
- import path from 'node:path';
5
- import { filename, writeConfig } from '../src/config.js';
6
-
7
- const file = path.join(os.homedir(), filename);
8
- if (!fs.existsSync(file)) {
9
- writeConfig(file, { version: 1, stores: {}, defaults: { nodelete: true, themeEditorSync: true } }, { create: true });
10
- console.log(`Created ${file}`);
11
- }