Skip to content
This repository has been archived by the owner on Feb 5, 2023. It is now read-only.

Commit

Permalink
fix: Don't publish by default
Browse files Browse the repository at this point in the history
  • Loading branch information
ffflorian committed Jun 12, 2019
1 parent ed5f07c commit c47f787
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 10 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
# publish-flat [![Build Status](https://action-badges.now.sh/ffflorian/publish-flat)](https://github.com/ffflorian/publish-flat/actions/) [![npm version](https://img.shields.io/npm/v/publish-flat.svg?style=flat)](https://www.npmjs.com/package/publish-flat) [![Dependabot Status](https://api.dependabot.com/badges/status?host=github&repo=ffflorian/publish-flat)](https://dependabot.com)

Publish your project flattened.
Publish your project flattened. No more `require('dependency/dist/Options')`.

## Description

Here is what it does:

1. Re-build your project
2. Copy your dist files into a temporary directory
3. Publish your project from the temporary directory
1. Re-builds your project
2. Copies your dist files together with the other release files into a temporary directory
3. Aligns your `package.json` to work with the flattened structure
4. Publishes your project from the temporary directory (optional)

## Installation

Expand All @@ -28,7 +29,7 @@ Options:
-c, --yarn Use yarn for publishing (default: false)
-f, --flatten <dir> Which directory to flatten (default: "dist")
-o, --output <dir> Set the output directory (default: temp directory)
-n, --no-publish Do not publish (default: false)
-p, --publish Publish (default: false)
-h, --help output usage information
```

Expand Down
6 changes: 3 additions & 3 deletions src/FlatPublisher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ export class FlatPublisher {

constructor(options: PublishOptions) {
this.options = options;
this.logger = logdown('flat-publish', {
this.logger = logdown('publish-flat', {
logger: console,
markdown: false,
});
Expand All @@ -54,7 +54,7 @@ export class FlatPublisher {
}

private createTempDir(): Promise<string> {
return fs.mkdtemp(path.join(os.tmpdir(), 'flat-publish-'));
return fs.mkdtemp(path.join(os.tmpdir(), 'publish-flat-'));
}

private async cleanPackageJson(filePath: string, filesInFlattenedDir: FilesInFlattenedDir): Promise<void> {
Expand Down Expand Up @@ -134,7 +134,7 @@ export class FlatPublisher {
});
}

this.logger.info(`Flattened ${filesInFlattenedDir.length} files`);
this.logger.info(`Flattened ${filesInFlattenedDir.length} files in "${outputDir}".`);

await this.cleanPackageJson(path.join(outputDir, 'package.json'), filesInFlattenedDir);

Expand Down
3 changes: 1 addition & 2 deletions src/cli.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ program
.option('-c, --yarn', 'Use yarn for publishing (default: false)')
.option('-f, --flatten <dir>', 'Which directory to flatten', 'dist')
.option('-o, --output <dir>', 'Set the output directory (default: temp directory)')
.option('-n, --no-publish', 'Do not publish (default: false)')
.option('-p, --publish', 'Publish (default: false)')
.arguments('[dir]')
.allowUnknownOption()
.parse(process.argv);
Expand All @@ -35,7 +35,6 @@ flatPublisher
if (program.publish && outputDir) {
return flatPublisher.publish(outputDir);
}
console.log(outputDir);
return;
})
.catch(error => {
Expand Down

0 comments on commit c47f787

Please sign in to comment.