-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
130 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,18 +1,119 @@ | ||
<template> | ||
<div class="howto"> | ||
<v-container> | ||
<v-container> | ||
<h1>HowTo publish packages</h1> | ||
<h2>(For new packages) initialize an npm module</h2> | ||
<pre v-highlightjs><code class="bash">npm init</code></pre> | ||
<p> | ||
This will create a <code class="hljs">package.json</code> file for your new module. If you already have one, proceed with the next step. | ||
</p> | ||
<h2>Configure artifactory as an npm registry for your company</h2> | ||
<h3>Alternative 1) Globally</h3> | ||
<pre v-highlightjs v-if="data.artifactoryUrl"><code class="bash">npm set registry {{data.companyScope ? `@${data.companyScope}:` : ''}}{{data.artifactoryUrl}}</code></pre> | ||
<v-subheader>More info:</v-subheader> | ||
<v-list :class="`link-list`"> | ||
<v-list-tile><a href="https://docs.npmjs.com/cli/config" target="_blank">https://docs.npmjs.com/cli/config</a></v-list-tile> | ||
<v-list-tile><a href="https://docs.npmjs.com/misc/config#registry" target="_blank">https://docs.npmjs.com/misc/config#registry</a></v-list-tile> | ||
</v-list> | ||
<h3>Alternative 2) Only for your npm package</h3> | ||
<pre v-highlightjs v-if="data.artifactoryUrl"><code class="json"> | ||
<span class="caption">package.json</span> | ||
... | ||
"publishConfig": { | ||
"registry": "{{data.artifactoryUrl}}" | ||
} | ||
...</code></pre> | ||
<v-subheader>More info:</v-subheader> | ||
<v-list :class="`link-list`"> | ||
<v-list-tile><a href="https://docs.npmjs.com/files/package.json#publishconfig" target="_blank">https://docs.npmjs.com/files/package.json#publishconfig</a></v-list-tile> | ||
</v-list> | ||
<h2>Define files that should be included in your npm package</h2> | ||
<pre v-highlightjs><code class="json"> | ||
<span class="caption">package.json (example)</span> | ||
"files": [ | ||
"assets" | ||
"dist", | ||
"cli.js" | ||
"index.js" | ||
]</code></pre> | ||
<h2>Commit everything</h2> | ||
<pre v-highlightjs><code class="bash">git commit</code></pre> | ||
<h2>Create a new version of your package</h2> | ||
<pre v-highlightjs><code class="bash">npm version [<newversion> | major | minor | patch ] | ||
|
||
<h1>HowTo publish packages</h1> | ||
<p> | ||
Bla | ||
</p> | ||
</v-container> | ||
'npm [-v | --version]' to print npm version | ||
'npm view <pkg> version' to view a package's published version | ||
'npm ls' to inspect current package/dependency versions</code></pre> | ||
<v-subheader>More info:</v-subheader> | ||
<v-list :class="`link-list`"> | ||
<v-list-tile><a href="https://docs.npmjs.com/cli/version" target="_blank">https://docs.npmjs.com/cli/version</a></v-list-tile> | ||
<v-list-tile><a href="https://semver.org/" target="_blank">semver.org</a></v-list-tile> | ||
</v-list> | ||
<h2>Publish package</h2> | ||
<pre v-highlightjs><code class="bash">npm publish</code></pre> | ||
<v-subheader>More info:</v-subheader> | ||
<v-list :class="`link-list`"> | ||
<v-list-tile><a href="https://docs.npmjs.com/cli/publish" target="_blank">https://docs.npmjs.com/cli/publish</a></v-list-tile> | ||
</v-list> | ||
<h2>Useful references</h2> | ||
<v-list :class="`link-list`"> | ||
<v-list-tile><a href="https://www.npmjs.com/package/release-it" target="_blank">release-it</a></v-list-tile> | ||
<v-list-tile><a href="https://github.com/geddski/grunt-release" target="_blank">grunt-release</a></v-list-tile> | ||
<v-list-tile><a href="https://docs.npmjs.com/misc/scripts#description" target="_blank">How npm handles the "scripts" field</a></v-list-tile> | ||
<v-list-tile><a href="https://semver.org/" target="_blank">semver.org</a></v-list-tile> | ||
</v-list> | ||
</v-container> | ||
</div> | ||
</template> | ||
|
||
<script lang="ts"> | ||
import { Component, Vue } from 'vue-property-decorator'; | ||
import DataStore from '@/services/DataStore'; | ||
@Component | ||
export default class HowTo extends Vue {} | ||
export default class HowTo extends Vue { | ||
private data: { | ||
artifactoryUrl: string, | ||
companyScope: string, | ||
} = { | ||
artifactoryUrl: '', | ||
companyScope: '', | ||
}; | ||
constructor() { | ||
super(); | ||
DataStore.Instance.getConfig().then((response) => { | ||
console.log(response); | ||
if (response) { | ||
this.data.artifactoryUrl = `http${ | ||
response.artifactory.https ? 's' : '' | ||
}://${ | ||
response.artifactory.host | ||
}/artifactory/api/npm/${ | ||
response.artifactory.repoKey | ||
}/`; | ||
this.data.companyScope = response.companyScope; | ||
} | ||
}); | ||
} | ||
} | ||
</script> | ||
|
||
<style lang="scss"> | ||
.v-list.link-list { | ||
background-color: transparent; | ||
} | ||
a[target="_blank"] { | ||
&::before { | ||
content: "↗"; | ||
display: inline-block; | ||
vertical-align: baseline; | ||
margin-right: .7em; | ||
font-weight: bold; | ||
} | ||
} | ||
</style> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters