Skip to content

Commit

Permalink
Publish fixes (#217)
Browse files Browse the repository at this point in the history
* move lib folder to src.

* fix publishing

* export types

* move nem-fs to dependencies.

mem-fs is now required due to types and conflicts with v2 types.
Since peerDependencies overrides dependencies, we cannot have peerDependencies safeguard anymore if we allow mem-fs-editor to run with mem-fs v2.
  • Loading branch information
mshima authored Apr 18, 2023
1 parent 75eabea commit b32fd69
Show file tree
Hide file tree
Showing 43 changed files with 31 additions and 40 deletions.
2 changes: 1 addition & 1 deletion __tests__/append-tpl.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import os from 'os';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/append.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import os from 'os';
import { MemFsEditor, create } from '../lib/index.js';
import { MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';

describe('#write()', () => {
Expand Down
2 changes: 1 addition & 1 deletion __tests__/commit-file-async.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import os from 'os';
import path from 'path';
import { create as createMemFs } from 'mem-fs';
import sinon from 'sinon';
import { type MemFsEditor, type MemFsEditorFile, create } from '../lib/index.js';
import { type MemFsEditor, type MemFsEditorFile, create } from '../src/index.js';

const rmSync = filesystem.rmSync || filesystem.rmdirSync;

Expand Down
4 changes: 2 additions & 2 deletions __tests__/commit.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import os from 'os';
import path from 'path';
import { create as createMemFs } from 'mem-fs';
import sinon from 'sinon';
import { MemFsEditor, create } from '../lib/index.js';
import { createTransform } from '../lib/transform.js';
import { MemFsEditor, create } from '../src/index.js';
import { createTransform } from '../src/transform.js';
import { getFixture } from './fixtures.js';

const rmSync = filesystem.rmSync || filesystem.rmdirSync;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/copy-async.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import filesystem from 'fs';
import os from 'os';
import path from 'path';
import sinon from 'sinon';
import { MemFsEditor, create } from '../lib/index.js';
import { MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/copy-tpl-async.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, beforeEach, it, expect } from 'vitest';
import os from 'os';
import path from 'path';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import normalize from 'normalize-path';
import { getFixture } from './fixtures.js';
Expand Down
4 changes: 2 additions & 2 deletions __tests__/copy-tpl.spec.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
import { describe, beforeEach, it, expect } from 'vitest';
import os from 'os';
import path from 'path';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import normalize from 'normalize-path';
import { getFixture } from './fixtures.js';
import { CopyOptions } from '../lib/actions/copy.js';
import { CopyOptions } from '../src/actions/copy.js';

describe('#copyTpl()', () => {
let store;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/copy.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import filesystem from 'fs';
import os from 'os';
import path, { dirname } from 'path';
import sinon from 'sinon';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';
import { fileURLToPath } from 'url';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/delete.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import path from 'path';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/dump.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import filesystem from 'fs';
import os from 'os';
import path from 'path';
import { create as createMemFs } from 'mem-fs';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';

const rmSync = filesystem.rmSync || filesystem.rmdirSync;

Expand Down
2 changes: 1 addition & 1 deletion __tests__/exists.spec.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { describe, beforeEach, it, expect } from 'vitest';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/extend-json.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it } from 'vitest';
import sinon from 'sinon';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/move.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import { describe, beforeEach, it, expect } from 'vitest';
import os from 'os';
import path from 'path';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/read-json.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import sinon from 'sinon';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import escape from 'escape-regexp';
import { getFixture } from './fixtures.js';
Expand Down
2 changes: 1 addition & 1 deletion __tests__/read.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import os from 'os';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/state.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
setCommittedFile,
setDeletedFileState,
setModifiedFileState,
} from '../lib/state.js';
} from '../src/state.js';

describe('state', () => {
let file;
Expand Down
2 changes: 1 addition & 1 deletion __tests__/util.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { describe, it, expect } from 'vitest';
import filesystem from 'fs';
import path from 'path';
import sinon from 'sinon';
import { getCommonPath, globify } from '../lib/util.js';
import { getCommonPath, globify } from '../src/util.js';
import normalize from 'normalize-path';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/write-json.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import sinon from 'sinon';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
2 changes: 1 addition & 1 deletion __tests__/write.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { describe, beforeEach, it, expect } from 'vitest';
import sinon from 'sinon';
import { type MemFsEditor, create } from '../lib/index.js';
import { type MemFsEditor, create } from '../src/index.js';
import { create as createMemFs } from 'mem-fs';
import { getFixture } from './fixtures.js';

Expand Down
9 changes: 1 addition & 8 deletions package-lock.json

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

11 changes: 2 additions & 9 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
}
},
"files": [
"lib"
"dist"
],
"dependencies": {
"@types/ejs": "^3.1.2",
Expand All @@ -40,20 +40,13 @@
"ejs": "^3.1.9",
"globby": "^13.1.4",
"isbinaryfile": "^5.0.0",
"mem-fs": "^3.0.0",
"minimatch": "^9.0.0",
"multimatch": "^6.0.0",
"normalize-path": "^3.0.0",
"textextensions": "^5.13.0",
"vinyl": "^3.0.0"
},
"peerDependencies": {
"mem-fs": "^2.1.0"
},
"peerDependenciesMeta": {
"mem-fs": {
"optional": true
}
},
"devDependencies": {
"coveralls": "^3.0.3",
"escape-regexp": "0.0.1",
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
5 changes: 5 additions & 0 deletions lib/index.ts → src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ import commit from './actions/commit.js';
import commitFileAsync from './actions/commit-file-async.js';
import dump from './actions/dump.js';

export type { AppendOptions } from './actions/append.js';
export type { CopyOptions } from './actions/copy.js';
export type { CopyAsyncOptions } from './actions/copy-async.js';
export type { MemFsEditorFileDump } from './actions/dump.js';

export interface MemFsEditorFile {
path: string;
stat?: { mode?: number } | null;
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"include": ["lib/**/*"],
"include": ["src/**/*"],
"compilerOptions": {
/* Language and Environment */
"target": "ES2022" /* Set the JavaScript language version for emitted JavaScript and include compatible library declarations. */,
Expand All @@ -10,7 +10,7 @@

/* Modules */
"module": "node16" /* Specify what module code is generated. */,
"rootDir": "./lib" /* Specify the root folder within your source files. */,
"rootDir": "./src" /* Specify the root folder within your source files. */,
"resolveJsonModule": true,

/* JavaScript Support */
Expand Down

0 comments on commit b32fd69

Please sign in to comment.